package swing;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.awt.Toolkit;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;

public class Splash extends JDialog{
	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;  //  @jve:decl-index=0:visual-constraint="592,10"
	private JTextArea jTextArea = null;
	private JLabel jLabel1 = null;
	private Icon duke;  //  @jve:decl-index=0:
	private Box box;  //  @jve:decl-index=0:visual-constraint="569,114"
	private JLabel titulo = null;
	private JProgressBar jProgressBar = null;

	/**
	 * @param owner
	 */
	public Splash() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 *
	 * @return void
	 */
	private void initialize() {
		this.setTitle("Sistema especialista para a criação de cenários de produção");
		this.setSize(572, 319);
		this.setContentPane(getJContentPane());
		this.centralizar();
	}

	/**
	 * This method initializes jContentPane
	 *
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
            if (jContentPane == null) {
		Font fonte = new Font("Serif", Font.BOLD, 20);
		titulo = new JLabel();
		titulo.setFont(fonte);
		titulo.setText("Sistema especialista para criação de cenários de produção.");
		jLabel1 = new JLabel();
		//duke = new ImageIcon("//media/0000-006F/Projetos/PPCP/src/br/com/ppcp/imagens/Dukejava.jpg");
        duke = new ImageIcon("/home/programador/workspace/PPCP-Havaianas/src/main/java/imagens/DukeJava.JPG");
        jLabel1 = new JLabel("",duke,SwingConstants.LEFT);
		jContentPane = new JPanel();
                box = Box.createHorizontalBox();
		box.add(new JScrollPane(getJTextArea()));
		jContentPane.setLayout(new BorderLayout());
		jContentPane.setSize(new Dimension(72, 80));
		jContentPane.add(box,BorderLayout.EAST);
		jContentPane.add(jLabel1, BorderLayout.WEST);
		jContentPane.add(titulo, BorderLayout.NORTH);
		jContentPane.add(getJProgressBar(), BorderLayout.SOUTH);
            }
		return jContentPane;
	}

	/**
	 * This method initializes jTextArea
	 *
	 * @return javax.swing.JTextArea
	 */
	private JTextArea getJTextArea() {
		if (jTextArea == null) {
			jTextArea = new JTextArea(9,30);
			jTextArea.setEditable(false);
		}
		return jTextArea;
	}

	 private void centralizar(){
	        /* Função para centralizar janela na tela */
	        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	        Dimension frameSize = getSize();
	        setLocation(new Point((screenSize.width)/4,(screenSize.height)/4));
	    }

	/**
	 * This method initializes jProgressBar
	 *
	 * @return javax.swing.JProgressBar
	 */
	private JProgressBar getJProgressBar() {
		if (jProgressBar == null) {
			jProgressBar = new JProgressBar();
			}
		return jProgressBar;
	}

	 public void setAtualizarBarra(int valor, String texto){
		 jProgressBar.setValue(jProgressBar.getValue() + valor );
		 jTextArea.setText(jTextArea.getText() + texto);
		 }
}
